package com.kkw.shoppingmall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.kkw.common.to.mq.SeckillOrderTo;
import com.kkw.common.utils.PageUtils;
import com.kkw.shoppingmall.order.entity.OrderEntity;
import com.kkw.shoppingmall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author Kevin
 * @email 871828295@qq.com
 * @date 2021-05-10 14:09:04
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要用的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 提交了订单，成功则去支付页面
     * @param vo
     * @return
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 订单超时 关闭订单
     * @param entity
     */
    void closeOrder(OrderEntity entity);

    /**
     * 获取当前订单的支付信息
     * @param orderSn
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 用户列表订单详情
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     *处理支付宝支付成功后的回调
     * @param payAsyncVo
     * @return
     */
    String handlePayResult(PayAsyncVo payAsyncVo);

    /**
     * 保存秒杀的订单
     * @param orderTo
     */
    void createSeckillOrder(SeckillOrderTo orderTo);
}

